package org.apache.jsp.view.comprar.prateleira;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import br.com.skpharma.vo.*;
import br.com.skpharma.dao.*;
import java.util.*;

public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=iso-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<script language=\"JavaScript\">\r\n");
      out.write("function buscaMarca(valor)\r\n");
      out.write("{\r\n");
      out.write(" \twindow.location.href=\"index.jsp?mar=\" + valor.value;\r\n");
      out.write("}\r\n");
      out.write("function buscaPrin(valor)\r\n");
      out.write("{\r\n");
      out.write(" \twindow.location.href=\"index.jsp?prin=\" + valor.value;\r\n");
      out.write("}\r\n");
      out.write("</script>\r\n");
      out.write(" \r\n");
      out.write("<head>\r\n");
      out.write("<title></title>\r\n");
      out.write("<link href=\"../../css/css.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write("body {\r\n");
      out.write("\tmargin-left: 0px;\r\n");
      out.write("\tmargin-top: 0px;\r\n");
      out.write("\tmargin-right: 0px;\r\n");
      out.write("\tmargin-bottom: 0px;\r\n");
      out.write("}\r\n");
      out.write(".style1 {\r\n");
      out.write("\tcolor: #FFFFFF;\r\n");
      out.write("\tfont-weight: bold;\r\n");
      out.write("}\r\n");
      out.write("a:link {\r\n");
      out.write("\tcolor: #000000;\r\n");
      out.write("\ttext-decoration: none;\r\n");
      out.write("}\r\n");
      out.write("a:visited {\r\n");
      out.write("\ttext-decoration: none;\r\n");
      out.write("\tcolor: #000000;\r\n");
      out.write("}\r\n");
      out.write("a:hover {\r\n");
      out.write("\ttext-decoration: none;\r\n");
      out.write("\tcolor: #999999;\r\n");
      out.write("}\r\n");
      out.write("a:active {\r\n");
      out.write("\ttext-decoration: none;\r\n");
      out.write("\tcolor: #000000;\r\n");
      out.write("}\r\n");
      out.write("-->\r\n");
      out.write("</style></head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<p align=\"left\"><strong><br>\r\n");
      out.write("Produtos de Conveni&ecirc;ncia</strong></p>\r\n");
      out.write("\r\n");
      out.write("<form method=\"POST\" action=\"index.jsp\" >\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<table width=\"700\" border=\"0\" align=\"left\" cellpadding=\"5\" cellspacing=\"2\" bordercolor=\"#f2f2f2\" style=\"font-size:12px\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td width=\"38%\" bgcolor=\"#941C1D\"><p class=\"style1\">Modelo:\r\n");
      out.write("      \r\n");
      out.write("        <input style=\"font-size:12px\" type=\"text\" name=\"txtModelo\" size=\"20\" >\r\n");
      out.write("        <input type=\"submit\" name=\"buscaModelo\" style=\"font-size:10px\" value=\"Buscar\" >\r\n");
      out.write("        \r\n");
      out.write("      </p>    </td>    \r\n");
      out.write("    <td width=\"20%\" bgcolor=\"#941C1D\"><p class=\"style1\">Marca:\r\n");
      out.write("      \r\n");
      out.write("        <select style=\"font-size:12px\" name=\"marca\" onkeypress=\"javascript:buscaMarca(this)\" >\r\n");
      out.write("          ");

      		DAOMarca daoMarca = new DAOMarca();
      		ArrayList lista2 = new ArrayList();
      		lista2 = daoMarca.obterLista();		
      		for (int i = 0; i<lista2.size(); i++){
      
      out.write("\r\n");
      out.write("          <option value=\"");
      out.print(((MarcaVO)lista2.get(i)).getCod());
      out.write('"');
      out.write('>');
      out.print(((MarcaVO)lista2.get(i)).getDs());
      out.write("</option>\r\n");
      out.write("          ");

        }
	  
      out.write("      \r\n");
      out.write("          </select>\r\n");
      out.write("        \r\n");
      out.write("      </p>    </td>\r\n");
      out.write("    <td width=\"8%\" bgcolor=\"#941C1D\"><span class=\"style1\">Preço</span></td>\r\n");
      out.write("    <td width=\"10%\" bgcolor=\"#941C1D\"><span class=\"style1\">Conteúdo</span></td>\r\n");
      out.write("    <td width=\"20%\" bgcolor=\"#941C1D\"><p class=\"style1\">Tipo:\r\n");
      out.write("      \r\n");
      out.write("        <select style=\"font-size:12px\" name=\"tipo\" onkeypress=\"javascript:buscaPrin(this)\" >\r\n");
      out.write("          ");

      		DAOTipo daoTipo = new DAOTipo();
      		ArrayList lista = new ArrayList();
      		lista = daoTipo.obterLista();		
      		for (int i = 0; i<lista.size(); i++){
      
      out.write("\r\n");
      out.write("          <option value=\"");
      out.print(((TipoVO)lista.get(i)).getCod());
      out.write('"');
      out.write('>');
      out.print(((TipoVO)lista.get(i)).getDs());
      out.write("</option>\r\n");
      out.write("          ");

        }
	  
      out.write("      \r\n");
      out.write("          </select>\r\n");
      out.write("        \r\n");
      out.write("      </p>    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("\r\n");

if (request.getParameter("prin") != null){
	int codigo = Integer.valueOf(request.getParameter("prin"));
		DAOPrateleira daoPrateleira = new DAOPrateleira();
		ArrayList lista3 = new ArrayList();
		lista3 = daoPrateleira.buscaTipo(codigo);	
		for (int i = 0; i<lista3.size(); i++){
			
		
      out.write("\r\n");
      out.write("\t\t  \t\t<tr>\r\n");
      out.write("\t\t\t\t    <td width=\"38%\"><a href=\"detalhe.jsp?cod_prat=");
      out.print(((PrateleiraVO)lista3.get(i)).getCod());
      out.write('"');
      out.write('>');
      out.write(' ');
      out.print(((PrateleiraVO)lista3.get(i)).getModeloVO().getDs());
      out.write("</a></td>\r\n");
      out.write("\t\t\t\t    <td width=\"20%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getModeloVO().getMarcaVO().getDs());
      out.write("</td>\r\n");
      out.write("\t\t\t\t    <td width=\"8%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getPreco());
      out.write("</td>\r\n");
      out.write("\t\t\t\t    <td width=\"10%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getConteudo());
      out.write("</td>\r\n");
      out.write("\t\t\t\t    <td width=\"20%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getTipoVO().getDs());
      out.write("</td>\r\n");
      out.write("\t\t\t\t</tr>\r\n");
      out.write("\t\t");
		
		}
}else

if (request.getParameter("mar") != null){
	int codigo = Integer.valueOf(request.getParameter("mar"));
		DAOPrateleira daoPrateleira = new DAOPrateleira();
		ArrayList lista3 = new ArrayList();
		lista3 = daoPrateleira.buscaMarca(codigo);	
		for (int i = 0; i<lista3.size(); i++){
			
		
      out.write("\r\n");
      out.write("\t\t  \t\t<tr>\r\n");
      out.write("\t\t\t\t    <td width=\"38%\"><a href=\"detalhe.jsp?cod_prat=");
      out.print(((PrateleiraVO)lista3.get(i)).getCod());
      out.write('"');
      out.write('>');
      out.write(' ');
      out.print(((PrateleiraVO)lista3.get(i)).getModeloVO().getDs());
      out.write("</a></td>\r\n");
      out.write("\t\t\t\t    <td width=\"20%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getModeloVO().getMarcaVO().getDs());
      out.write("</td>\r\n");
      out.write("\t\t\t\t    <td width=\"8%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getPreco());
      out.write("</td>\r\n");
      out.write("\t\t\t\t    <td width=\"10%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getConteudo());
      out.write("</td>\r\n");
      out.write("\t\t\t\t    <td width=\"20%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getTipoVO().getDs());
      out.write("</td>\r\n");
      out.write("\t\t\t\t</tr>\r\n");
      out.write("\t\t");
		
		}
}else
if (request.getParameter("txtModelo") != ""){
		if(request.getParameter("buscaModelo") != null){
			DAOPrateleira daoPrateleira = new DAOPrateleira();
			ArrayList lista3 = new ArrayList();
			String nome = request.getParameter("txtModelo");
			lista3 = daoPrateleira.buscaModelo(nome);		
			for (int i = 0; i<lista3.size(); i++){
	

      out.write("\r\n");
      out.write("  \t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t    <td width=\"38%\"><a href=\"detalhe.jsp?cod_prat=");
      out.print(((PrateleiraVO)lista3.get(i)).getCod());
      out.write('"');
      out.write('>');
      out.write(' ');
      out.print(((PrateleiraVO)lista3.get(i)).getModeloVO().getDs());
      out.write("</a></td>\r\n");
      out.write("\t\t    \t\t<td width=\"20%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getModeloVO().getMarcaVO().getDs());
      out.write("</td>\r\n");
      out.write("\t\t    \t\t<td width=\"8%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getPreco());
      out.write("</td>\r\n");
      out.write("\t\t    \t\t<td width=\"10%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getConteudo());
      out.write("</td>\r\n");
      out.write("\t\t    \t\t<td width=\"20%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getTipoVO().getDs());
      out.write("</td>\r\n");
      out.write("\t\t\t\t</tr>\r\n");
		
			}
		}
	}
else{
DAOPrateleira daoPrateleira = new DAOPrateleira();
ArrayList lista3 = new ArrayList();
lista3 = daoPrateleira.obterLista();	
	for (int i = 0; i<lista3.size(); i++){
	

      out.write("\r\n");
      out.write("  \t\t<tr>\r\n");
      out.write("\t\t    <td width=\"38%\"><a href=\"detalhe.jsp?cod_prat=");
      out.print(((PrateleiraVO)lista3.get(i)).getCod());
      out.write('"');
      out.write('>');
      out.write(' ');
      out.print(((PrateleiraVO)lista3.get(i)).getModeloVO().getDs());
      out.write("</a></td>\r\n");
      out.write("\t\t    <td width=\"20%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getModeloVO().getMarcaVO().getDs());
      out.write("</td>\r\n");
      out.write("\t\t    <td width=\"8%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getPreco());
      out.write("</td>\r\n");
      out.write("\t\t    <td width=\"10%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getConteudo());
      out.write("</td>\r\n");
      out.write("\t\t    <td width=\"20%\">");
      out.print(((PrateleiraVO)lista3.get(i)).getTipoVO().getDs());
      out.write("</td>\r\n");
      out.write("\t\t</tr>\r\n");
		

	}
}

      out.write("\r\n");
      out.write("</table>\r\n");
      out.write("</form>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
      out.write("\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
